/*************************************************************************
 Copyright (C) Unpublished Unis Software, Inc. All rights reserved.
 Unis Software, Inc., Confidential and Proprietary.

 This software is subject to copyright protection
 under the laws of the Public of China and other countries.

 Unless otherwise explicitly stated, this software is provided
 by Unis "AS IS".
 *************************************************************************/
package com.unis.service.example;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.unis.dao.IDataSet4iBatis;
import com.unis.model.BaseModel;
import com.unis.model.example.User;

/**
 * @author CSJ (email:raulcsj@163.com)
 * @since 2012-11-10
 */
@Service
public class UserServiceImpl implements UserService {

    private IDataSet4iBatis iDataSet4iBatis;

    public void insert(User user) {
        iDataSet4iBatis.insert(user);
        if ("5".equals(user.getUserId()))
            throw new RuntimeException();
    }

    public void update(User user) {
        iDataSet4iBatis.update(user);
    }

    public void delete(User user) {
        iDataSet4iBatis.delete(user);
    }

    public List<BaseModel> queryAsList(User user) {
        return iDataSet4iBatis.queryAsList(user);
    }

    public BaseModel queryAsObject(User user) {
        return iDataSet4iBatis.queryAsObject(user);
    }

    @Resource
    public void setiDataSet4iBatis(IDataSet4iBatis iDataSet4iBatis) {
        this.iDataSet4iBatis = iDataSet4iBatis;
    }
}
